<?php
/**
 * 公共事务
 */
defined('APP_ROOT') 		or define('APP_ROOT', dirname(__FILE__));
defined('VENDOR_PATH') 		or define('VENDOR_PATH', APP_ROOT . '/vendors/');
defined('ATTACHMENT_PATH') 	or define('ATTACHMENT_PATH', APP_ROOT . '/attachments/');
defined('APP_URL') 			or define('APP_URL', '.');
defined('APP_VIEW_PATH') 	or define('APP_VIEW_PATH', APP_ROOT . '/views/');
defined('CONF_FILE_PATH') 	or define('CONF_FILE_PATH', APP_ROOT . '/conf.php');
defined('STATIC_FILE_PATH') or define('STATIC_FILE_PATH', APP_VIEW_PATH. '/statics/');
defined('STATIC_FILE_URL')  or define('STATIC_FILE_URL', APP_URL. '/views/statics');
defined('STATIC_LIB_URL')   or define('STATIC_LIB_URL', STATIC_FILE_URL. '/lib');
defined('TPL_NAME') 		or define('TPL_NAME', 'main');
defined('APP_VIEW_EXT') 	or define('APP_VIEW_EXT', ".view.php");
defined('APP_TPL_EXT') 		or define('APP_TPL_EXT', ".tpl.php");
defined('BASE_URL')			or define('BASE_URL', (isset($_SERVER['REQUEST_SCHEME'])?$_SERVER['REQUEST_SCHEME']:'http') .'://'.$_SERVER['HTTP_HOST']);
defined('SERVER_URL')		or define('SERVER_URL',preg_replace("/\/$/", "", BASE_URL . (str_replace('\\','/',dirname($_SERVER['SCRIPT_NAME'])))));
defined('VAR_TIME_NOW')		or define('VAR_TIME_NOW', time());

header('X-Powered-By: simo.wxSimpleFrame');
header('Server: simo.tomcat');
session_start();

@include APP_ROOT .'/lib/core.php';
C('_APP_STATUS', 'inited');
loadLibs(C('libs'));
C('get', UtilHelper::safe_sql($_GET));
C('post', UtilHelper::safe_sql($_POST));

// 调试模式下，修改数据库配置。 最优解：lib.C 加载不同的配置文件
if(C('debug')===true) {
	C('DBCONFIG', C('db_config_dev'));
}
?>
